package com.scheduling.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.scheduling.common.annotation.Log;
import com.scheduling.common.core.controller.BaseController;
import com.scheduling.common.core.domain.AjaxResult;
import com.scheduling.common.enums.BusinessType;
import com.scheduling.system.domain.Skillmanagement;
import com.scheduling.system.service.ISkillmanagementService;
import com.scheduling.common.utils.poi.ExcelUtil;
import com.scheduling.common.core.page.TableDataInfo;

/**
 * 技能管理Controller
 * 
 * @author mj
 * @date 2025-05-07
 */
@RestController
@RequestMapping("/system/skillmanagement")
public class SkillmanagementController extends BaseController
{
    @Autowired
    private ISkillmanagementService skillmanagementService;

    /**
     * 查询技能管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:skillmanagement:list')")
    @GetMapping("/list")
    public TableDataInfo list(Skillmanagement skillmanagement)
    {
        startPage();
        List<Skillmanagement> list = skillmanagementService.selectSkillmanagementList(skillmanagement);
        return getDataTable(list);
    }

    /**
     * 导出技能管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:skillmanagement:export')")
    @Log(title = "技能管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Skillmanagement skillmanagement)
    {
        List<Skillmanagement> list = skillmanagementService.selectSkillmanagementList(skillmanagement);
        ExcelUtil<Skillmanagement> util = new ExcelUtil<Skillmanagement>(Skillmanagement.class);
        util.exportExcel(response, list, "技能管理数据");
    }

    /**
     * 获取技能管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:skillmanagement:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(skillmanagementService.selectSkillmanagementById(id));
    }

    /**
     * 新增技能管理
     */
    @PreAuthorize("@ss.hasPermi('system:skillmanagement:add')")
    @Log(title = "技能管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Skillmanagement skillmanagement)
    {
        return toAjax(skillmanagementService.insertSkillmanagement(skillmanagement));
    }

    /**
     * 修改技能管理
     */
    @PreAuthorize("@ss.hasPermi('system:skillmanagement:edit')")
    @Log(title = "技能管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Skillmanagement skillmanagement)
    {
        return toAjax(skillmanagementService.updateSkillmanagement(skillmanagement));
    }

    /**
     * 删除技能管理
     */
    @PreAuthorize("@ss.hasPermi('system:skillmanagement:remove')")
    @Log(title = "技能管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(skillmanagementService.deleteSkillmanagementByIds(ids));
    }
}
